home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 5561 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.6 KB

  1. Path: pegasus.montclair.edu!harmon
  2. From: harmon@pegasus.montclair.edu (Derek Harmon)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Watch out! C "gotcha!"
  5. Date: 15 Feb 1996 02:35:23 -0500
  6. Organization: Montclair State University
  7. Message-ID: <harmon.824368912@pegasus.montclair.edu>
  8. References: <4fthhh$7th@blackice.winternet.com>
  9. NNTP-Posting-Host: pegasus.montclair.edu
  10. X-Newsreader: NN version 6.5.0 #68 (NOV)
  11.  
  12. mschwarz@winternet.com (Michael Schwarz) writes:
  13.  
  14. >   int x = 1;
  15. >   switch (x)
  16. >   {
  17. >      case 1:
  18. >         printf("It's 1.\n");
  19. >         goto defalt;
  20. >         break;
  21.  
  22. >It's 1.
  23. >It's not 1.
  24.  
  25. >My co-worker came back and said it compiled but there was an unreferenced
  26. >label warning.  Well, of course there was!
  27.  
  28.    Yes, your code illustrates it quite clearly.. if you have something other
  29. than default (this could also apply to case n, but would more likely be
  30. reported by a compiler as "cast 1:" would be a syntax error since the label
  31. expects a colon, except perhaps if your space bar sticks, so "case1:" would
  32. be a valid label identifier, wherever it might be) followed by a single
  33. colon wherever, it's a label.  You can goto it.
  34.  
  35.    An unreferenced label warning should tell you something, as should syntax
  36. highlighting (if your editor supports it).  Typos kill.  :)
  37.                                                                -- Stone
  38. --
  39. # Derek Harmon (aka Stonelight)    harmon@pegasus.montclair.edu
  40. # - Computer Science Undergrad, Montclair State University, NJ
  41. # - My views are my own, nobody else is this creative.  3;)>
  42. ... Objects in taglines are closer than they appear.
  43.  
  44.